home *** CD-ROM | disk | FTP | other *** search
/ Sports Illustrated for Kids - Awesome Athletes! / Sports Illustrated for Kids - Awesome Athletes!.iso / ma.dir / 00016_movie script01.ls < prev    next >
Encoding:
Text File  |  1996-04-18  |  22.6 KB  |  690 lines

  1. on MAmovie
  2.   global MAmenuList, MAnewGame, MASavedList, gHSState, gMAnextLev, gMAmenu, gMAgameMarker, gMALev, gMAsound, gMAflip, MAflavor
  3.   EnableIdleAnim(47, 48)
  4.   set the visible of sprite 44 to 0
  5.   set MAmenuList to [[#menu1a, #menu2a, #menu3a], [#menu1b, #menu2b, #menu3b], [#menu1c, #menu2c, #menu3c], [#menu1d, #menu2d, #menu3d]]
  6.   set the keyDownScript to "MAcheckKey"
  7.   set the text of cast "guessField" to " "
  8.   set the textSize of field "guessField" to 12
  9.   set the text of cast "guessField" to EMPTY
  10.   set MASavedList to []
  11.   set temp to HSStateGet("MA", "savedList")
  12.   set MASavedList to value(temp)
  13.   if listp(MASavedList) = 0 then
  14.     set MAnewGame to 1
  15.     set gMAgameMarker to 0
  16.     set gMALev to 1
  17.     set gMAnextLev to 1
  18.     set gMAsound to 1
  19.     set gMAflip to 1
  20.     set MAflavor to getAt(MAmenuList, 1)
  21.     set gMAmenu to the number of cast "menu1a"
  22.     MAinitGame()
  23.   end if
  24.   if listp(MASavedList) = 1 then
  25.     MAgetStates()
  26.     MAinitGame()
  27.   end if
  28. end
  29.  
  30. on MAdoConButtons
  31.   global gMAmenu, gMAcurrAth, gMAsound, gMAflip, gMALev, MAflavor, gMAnextLev, MAclearedGrid
  32.   repeat while (the mouseH > 0) and (the mouseH < 640) and (the mouseV < 16)
  33.     if (the mouseH > 0) and (the mouseH < 640) and (the mouseV < 16) then
  34.       set the castNum of sprite 44 to gMAmenu
  35.     end if
  36.     set the visible of sprite 44 to 1
  37.     repeat while (the mouseH > 0) and (the mouseH < 102) and (the mouseV < 16)
  38.       if (the mouseH > 0) and (the mouseH < 102) and (the mouseV < 16) then
  39.         set the castNum of sprite 45 to the number of cast "how-hi.btn"
  40.       end if
  41.       updateStage()
  42.       if the mouseDown then
  43.         LaunchHelp()
  44.         exit repeat
  45.       end if
  46.     end repeat
  47.     repeat while (the mouseH > 115) and (the mouseH < 205) and (the mouseV < 16)
  48.       if (the mouseH > 115) and (the mouseH < 205) and (the mouseV < 16) then
  49.         set the castNum of sprite 45 to the number of cast "new puz-hi.btn"
  50.       end if
  51.       updateStage()
  52.       if the mouseDown then
  53.         go("gameFrame")
  54.         updateStage()
  55.         HSStatePut("ma", "not1stTime", "1")
  56.         set the text of cast "guessField" to EMPTY
  57.         MAinitGame()
  58.         goSetUp(1)
  59.         setUpCards(1)
  60.         set the visible of sprite 44 to 0
  61.         exit repeat
  62.       end if
  63.     end repeat
  64.     repeat while (the mouseH > 225) and (the mouseH < 315) and (the mouseV < 16)
  65.       if (the mouseH > 225) and (the mouseH < 315) and (the mouseV < 16) then
  66.         set the castNum of sprite 45 to the number of cast "solve-hi.btn"
  67.       end if
  68.       updateStage()
  69.       if the mouseDown then
  70.         puppetSprite(40, 1)
  71.         set the text of cast "guessField" to gMAcurrAth
  72.         repeat with I = 16 to 39
  73.           puppetSprite(I, 0)
  74.         end repeat
  75.         set MAclearedGrid to list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
  76.         MAshowLetters()
  77.         MAdoHistory()
  78.         set the visible of sprite 44 to 0
  79.         exit repeat
  80.       end if
  81.     end repeat
  82.     repeat while (the mouseH > 330) and (the mouseH < 420) and (the mouseV < 16) and (the mouseDown = 0)
  83.       if gMAnextLev = 1 then
  84.         if (the mouseH > 330) and (the mouseH < 420) and (the mouseV < 16) then
  85.           set the castNum of sprite 45 to the number of cast "lev01-hi.btn"
  86.         end if
  87.         updateStage()
  88.       end if
  89.       if gMAnextLev = 2 then
  90.         if (the mouseH > 330) and (the mouseH < 420) and (the mouseV < 16) then
  91.           set the castNum of sprite 45 to the number of cast "lev02-hi.btn"
  92.         end if
  93.         updateStage()
  94.       end if
  95.       if gMAnextLev = 3 then
  96.         if (the mouseH > 330) and (the mouseH < 420) and (the mouseV < 16) then
  97.           set the castNum of sprite 45 to the number of cast "lev03-hi.btn"
  98.         end if
  99.         updateStage()
  100.       end if
  101.       if the mouseDown then
  102.         set gMAnextLev to gMAnextLev + 1
  103.         if gMAnextLev > 3 then
  104.           set gMAnextLev to 1
  105.         end if
  106.         set gMAmenu to the number of cast string(getAt(MAflavor, gMAnextLev))
  107.         if gMALev = 10 then
  108.           set gMALev to 2
  109.           set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  110.           exit repeat
  111.         end if
  112.         if gMALev = 20 then
  113.           set gMALev to 3
  114.           set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  115.           exit repeat
  116.         end if
  117.         if gMALev = 30 then
  118.           set gMALev to 1
  119.           set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  120.           exit repeat
  121.         end if
  122.         updateStage()
  123.       end if
  124.     end repeat
  125.     repeat while (the mouseH > 435) and (the mouseH < 530) and (the mouseV < 16) and (the mouseDown = 0)
  126.       if gMAsound = 1 then
  127.         if (the mouseH > 435) and (the mouseH < 530) and (the mouseV < 16) then
  128.           set the castNum of sprite 45 to the number of cast "sound on-hi.btn"
  129.         end if
  130.       end if
  131.       if gMAsound = 0 then
  132.         if (the mouseH > 435) and (the mouseH < 530) and (the mouseV < 16) then
  133.           set the castNum of sprite 45 to the number of cast "sound off-hi.btn"
  134.         end if
  135.       end if
  136.       updateStage()
  137.       if the mouseDown then
  138.         if gMAsound = 1 then
  139.           set gMAsound to 0
  140.           set the soundEnabled to 0
  141.           if gMAflip = 1 then
  142.             set MAflavor to getAt(MAmenuList, 2)
  143.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  144.             exit repeat
  145.           end if
  146.           if gMAflip = 0 then
  147.             set MAflavor to getAt(MAmenuList, 4)
  148.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  149.             exit repeat
  150.           end if
  151.         end if
  152.         if gMAsound = 0 then
  153.           set gMAsound to 1
  154.           set the soundEnabled to 1
  155.           if gMAflip = 1 then
  156.             set MAflavor to getAt(MAmenuList, 1)
  157.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  158.             exit repeat
  159.           end if
  160.           if gMAflip = 0 then
  161.             set MAflavor to getAt(MAmenuList, 3)
  162.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  163.             exit repeat
  164.           end if
  165.         end if
  166.         updateStage()
  167.       end if
  168.     end repeat
  169.     repeat while (the mouseH > 540) and (the mouseH < 640) and (the mouseV < 16) and (the mouseDown = 0)
  170.       if gMAflip = 1 then
  171.         if (the mouseH > 540) and (the mouseH < 640) and (the mouseV < 16) then
  172.           set the castNum of sprite 45 to the number of cast "flip on-hi.btn"
  173.         end if
  174.       end if
  175.       if gMAflip = 0 then
  176.         if (the mouseH > 540) and (the mouseH < 640) and (the mouseV < 16) then
  177.           set the castNum of sprite 45 to the number of cast "flip off-hi.btn"
  178.         end if
  179.       end if
  180.       updateStage()
  181.       if the mouseDown then
  182.         if gMAflip = 1 then
  183.           set gMAflip to 0
  184.           if gMAsound = 1 then
  185.             set MAflavor to getAt(MAmenuList, 3)
  186.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  187.             exit repeat
  188.           end if
  189.           if gMAsound = 0 then
  190.             set MAflavor to getAt(MAmenuList, 4)
  191.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  192.             exit repeat
  193.           end if
  194.         end if
  195.         if gMAflip = 0 then
  196.           set gMAflip to 1
  197.           if gMAsound = 1 then
  198.             set MAflavor to getAt(MAmenuList, 1)
  199.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  200.             exit repeat
  201.           end if
  202.           if gMAsound = 0 then
  203.             set MAflavor to getAt(MAmenuList, 2)
  204.             set gMAmenu to the number of cast string(getAt(MAflavor, gMALev))
  205.             exit repeat
  206.           end if
  207.         end if
  208.         updateStage()
  209.       end if
  210.     end repeat
  211.   end repeat
  212.   repeat while (the mouseH > 0) and (the mouseH < 60) and (the mouseV > 420)
  213.     if (the mouseH > 0) and (the mouseH < 60) and (the mouseV > 420) then
  214.       set the castNum of sprite 41 to the number of cast "back-hi.btn"
  215.     end if
  216.     updateStage()
  217.     if the mouseDown then
  218.       MAleaveGame()
  219.       updateStage()
  220.     end if
  221.   end repeat
  222.   repeat while (the mouseH > 575) and (the mouseH < 630) and (the mouseV > 420)
  223.     if (the mouseH > 575) and (the mouseH < 630) and (the mouseV > 420) then
  224.       set the castNum of sprite 41 to the number of cast "si kids-hi.btn"
  225.     end if
  226.     if the mouseDown then
  227.       updateStage()
  228.     end if
  229.   end repeat
  230.   repeat while (the mouseH > 361) and (the mouseH < 455) and (the mouseV > 455)
  231.     if (the mouseH > 361) and (the mouseH < 455) and (the mouseV > 455) then
  232.       set the castNum of sprite 41 to the number of cast "guess-hi.btn"
  233.     end if
  234.     updateStage()
  235.     if the mouseDown then
  236.       MAdoGuess()
  237.       updateStage()
  238.     end if
  239.   end repeat
  240.   set the visible of sprite 44 to 0
  241. end
  242.  
  243. on MAcheckKey
  244.   if (the key = RETURN) or (the key = ENTER) then
  245.     MAdoGuess()
  246.   end if
  247.   if (the text of cast "guessField" = RETURN) or (the text of cast "guessField" = ENTER) then
  248.     set the text of cast "guessField" to EMPTY
  249.   end if
  250. end
  251.  
  252. on MAdoGuess
  253.   global gMAcurrAth, gMAgameMarker, MAclearedGrid
  254.   if the text of cast "guessField" = gMAcurrAth then
  255.     set gMAgameMarker to gMAgameMarker + 1
  256.     repeat with vMAi = 16 to 39
  257.       set the loc of sprite vMAi to point(-500, -500)
  258.       puppetSprite(vMAi, 0)
  259.     end repeat
  260.     set MAclearedGrid to list(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
  261.     MAshowLetters()
  262.     MAdoHistory()
  263.   else
  264.     beep()
  265.     set the selStart to 0
  266.     set the text of cast "guessField" to EMPTY
  267.     put EMPTY before char 1 of field "guessField"
  268.   end if
  269. end
  270.  
  271. on MAdoHistory
  272.   global gMAathStr
  273.   puppetSprite(42, 1)
  274.   puppetSprite(43, 1)
  275.   set the stretch of sprite 43 to 0
  276.   set the locH of sprite 42 to 320
  277.   set the locV of sprite 42 to 240
  278.   set the locH of sprite 43 to 200
  279.   set the locV of sprite 43 to 242
  280.   set the trails of sprite 43 to 1
  281.   set the castNum of sprite 43 to the number of cast string("HS" & gMAathStr & ".pct")
  282.   updateStage()
  283.   set the trails of sprite 43 to 0
  284.   set the locH of sprite 43 to 286
  285.   set the locV of sprite 43 to 170
  286.   set the castNum of sprite 43 to the number of cast string("MA" & gMAathStr)
  287.   updateStage()
  288. end
  289.  
  290. on MAtimer ticks
  291.   startTimer()
  292.   repeat while the timer < ticks
  293.     nothing()
  294.   end repeat
  295. end
  296.  
  297. on MAturnPuppets aMAlow, aMAhigh, aMAway
  298.   repeat with N = aMAlow to aMAhigh
  299.     puppetSprite(N, aMAway)
  300.   end repeat
  301. end
  302.  
  303. on MAturnVisible aMAlow, aMAhigh, aMAway
  304.   repeat with N = aMAlow to aMAhigh
  305.     MAturnPuppets(N, N, aMAway)
  306.     set the visible of sprite N to aMAway
  307.   end repeat
  308. end
  309.  
  310. on MAinitGame
  311.   global gMAnextLev, gMALev, MAgridList, gMAlowSprite, gMAhighSprite, gMAlowLetterSprite, gMAmatch, MAclearedGrid
  312.   if gMAnextLev > 0 then
  313.     set gMALev to gMAnextLev
  314.   else
  315.     set gMALev to 1
  316.   end if
  317.   MAallOFF()
  318.   doMAathList()
  319.   set MAgridList to [point(77, 55), point(174, 55), point(271, 55), point(368, 55), point(465, 55), point(562, 55), point(77, 156), point(174, 156), point(271, 156), point(368, 156), point(465, 156), point(562, 156), point(77, 257), point(174, 257), point(271, 257), point(368, 257), point(465, 257), point(562, 257), point(77, 358), point(174, 358), point(271, 358), point(368, 358), point(465, 358), point(562, 358)]
  320.   set gMAlowSprite to 16
  321.   set gMAhighSprite to 39
  322.   set gMAlowLetterSprite to 2
  323.   set gMAmatch to EMPTY
  324.   set MAclearedGrid to list()
  325.   repeat with N = 1 to 24
  326.     append(MAclearedGrid, 1)
  327.   end repeat
  328.   MAdoAnimList()
  329. end
  330.  
  331. on MAsetTile aMAwhichTile, aMAwhatNum
  332.   global gMAlowSprite, MAgridList
  333.   puppetSprite(aMAwhichTile + gMAlowSprite - 1, 1)
  334.   set the castNum of sprite (aMAwhichTile + gMAlowSprite - 1) to cast aMAwhatNum
  335.   set the loc of sprite (aMAwhichTile + gMAlowSprite - 1) to getAt(MAgridList, aMAwhichTile)
  336. end
  337.  
  338. on MAunCover aMAwhichOne, aMAcolor
  339.   global gMAmatch, gMAlowSprite, gMAoldOne, MAanswergridList, MAclearedGrid, gOldvRot, gMAflip, MAanimList
  340.   set aMAplaceOnGrid to aMAwhichOne - gMAlowSprite + 1
  341.   MAdoAnim(aMAplaceOnGrid, aMAcolor, 0)
  342.   if gMAmatch = EMPTY then
  343.     set gMAmatch to getAt(MArandomGridlist, aMAplaceOnGrid)
  344.     set gMAoldOne to aMAwhichOne
  345.     set gOldvRot to integer(aMAcolor)
  346.   else
  347.     MAtimer(40)
  348.     set aMAright to MAcheckMatch(getAt(MArandomGridlist, aMAplaceOnGrid), gMAmatch)
  349.     if aMAright = 1 then
  350.       setAt(MAclearedGrid, aMAwhichOne - gMAlowSprite + 1, 0)
  351.       setAt(MAclearedGrid, gMAoldOne - gMAlowSprite + 1, 0)
  352.       MAshowLetters()
  353.       if the castNum of sprite 1 = 8 then
  354.         set the castNum of sprite 1 to 13
  355.       else
  356.         set the castNum of sprite 1 to 8
  357.       end if
  358.       updateStage()
  359.       set the locH of sprite aMAwhichOne to -2000
  360.       set the locH of sprite gMAoldOne to -2000
  361.     else
  362.       put aMAcolor
  363.       MAdoAnim(aMAplaceOnGrid, aMAcolor, 1)
  364.       set vRot to integer(aMAcolor)
  365.       MAsetTile(aMAwhichOne - gMAlowSprite + 1, getAt(getAt(MAanimList, vRot), 1))
  366.       put aMAcolor
  367.       MAdoAnim(gMAoldOne - gMAlowSprite + 1, aMAcolor, 1)
  368.       MAsetTile(gMAoldOne - gMAlowSprite + 1, getAt(getAt(MAanimList, gOldvRot), 1))
  369.       put aMAcolor
  370.     end if
  371.     set gMAmatch to EMPTY
  372.   end if
  373. end
  374.  
  375. on MAdoAnim aMAwhere, aMAwhichColor, aMAbackward
  376.   global MAanswergridList, MAanimList, gMAlowSprite, gMAflip
  377.   if gMAflip = 1 then
  378.     if aMAbackward = 1 then
  379.       repeat with N = 6 down to 2
  380.         MAsetTile(aMAwhere, getAt(getAt(MAanimList, aMAwhichColor), N))
  381.         updateStage()
  382.         MAtimer(3)
  383.       end repeat
  384.     else
  385.       repeat with N = 1 to 6
  386.         MAsetTile(aMAwhere, getAt(getAt(MAanimList, aMAwhichColor), N))
  387.         updateStage()
  388.         MAtimer(5)
  389.       end repeat
  390.       set the trails of sprite (aMAwhere + gMAlowSprite - 1) to 1
  391.       MAsetTile(aMAwhere, getAt(getAt(MAanimList, aMAwhichColor), 7))
  392.       updateStage()
  393.       MAsetTile(aMAwhere, getProp(MAuniqueIconList, getaProp(MAanswergridList, aMAwhere)))
  394.     end if
  395.     set the trails of sprite (aMAwhere + gMAlowSprite - 1) to 0
  396.     updateStage()
  397.   end if
  398.   if gMAflip = 0 then
  399.     set the trails of sprite (aMAwhere + gMAlowSprite - 1) to 1
  400.     MAsetTile(aMAwhere, getAt(getAt(MAanimList, aMAwhichColor), 7))
  401.     updateStage()
  402.     MAsetTile(aMAwhere, getProp(MAuniqueIconList, getaProp(MAanswergridList, aMAwhere)))
  403.     set the trails of sprite (aMAwhere + gMAlowSprite - 1) to 0
  404.     updateStage()
  405.   end if
  406. end
  407.  
  408. on MAcheckMatch aMAisThis, aMAthis
  409.   set aMAright to 0
  410.   if aMAisThis = aMAthis then
  411.     set aMAright to 1
  412.   else
  413.     beep()
  414.     set aMAright to 0
  415.   end if
  416.   return aMAright
  417. end
  418.  
  419. on MAshowLetters
  420.   global gMAcurrAth, MAanswergridList, MAclearedGrid, gMAlowLetterSprite, gMAcurNameLength, gMALev, gMAblanks, gMAspacelessName
  421.   repeat with N = 1 to 24
  422.     if getAt(MAclearedGrid, N) = 0 then
  423.       repeat with X = 1 to gMAcurNameLength + gMAblanks
  424.         if gMALev <> 2 then
  425.           if char X of gMAcurrAth = string(getAt(MAanswergridList, N)) then
  426.             if gMALev < 3 then
  427.               puppetSprite(X + gMAlowLetterSprite - 1, 1)
  428.               set the castNum of sprite (X + gMAlowLetterSprite - 1) to cast getAt(MAanswergridList, N)
  429.             end if
  430.             if gMALev > 2 then
  431.               set the loc of sprite (X + gMAlowLetterSprite - 1) to point(5 + (X * 33), 459)
  432.             end if
  433.           end if
  434.         end if
  435.         if gMALev = 2 then
  436.           if char X of gMAspacelessName = string(getAt(MAanswergridList, N)) then
  437.             puppetSprite(X + gMAlowLetterSprite - 1, 1)
  438.             set the castNum of sprite (X + gMAlowLetterSprite - 1) to cast getAt(MAanswergridList, N)
  439.           end if
  440.         end if
  441.       end repeat
  442.     end if
  443.   end repeat
  444. end
  445.  
  446. on makeAnswerGridList fromWhatList
  447.   global MAuniqueIconList
  448.   set thisList to list()
  449.   repeat with N = 1 to 24
  450.     if getAt(fromWhatList, N) > 0 then
  451.       append(thisList, string(getPropAt(MAuniqueIconList, getAt(fromWhatList, N))))
  452.       next repeat
  453.     end if
  454.     append(thisList, 0)
  455.   end repeat
  456.   return thisList
  457. end
  458.  
  459. on makeRandomGrid withHowMany
  460.   set usedList to [:]
  461.   repeat with N = 1 to 24
  462.     addProp(usedList, N, 0)
  463.   end repeat
  464.   set N to 1
  465.   repeat while N < (withHowMany + 1)
  466.     set try to EMPTY
  467.     repeat while try = EMPTY
  468.       set try to random(24)
  469.       if getAt(usedList, try) = 0 then
  470.         setAt(usedList, try, N)
  471.         set try to EMPTY
  472.         repeat while try = EMPTY
  473.           set try to random(24)
  474.           if getAt(usedList, try) = 0 then
  475.             setAt(usedList, try, N)
  476.             set N to N + 1
  477.             next repeat
  478.           end if
  479.           set try to EMPTY
  480.         end repeat
  481.         next repeat
  482.       end if
  483.       set try to EMPTY
  484.     end repeat
  485.   end repeat
  486.   return usedList
  487. end
  488.  
  489. on MAallOFF
  490.   MAturnPuppets(1, 48, 1)
  491.   MAturnVisible(1, 48, 1)
  492.   MAturnPuppets(1, 48, 0)
  493. end
  494.  
  495. on tellLoc
  496.   repeat with N = 16 to 39
  497.     put the loc of sprite N
  498.   end repeat
  499. end
  500.  
  501. on goSetUp MAnewGame
  502.   global MAgridList, gMAlowSprite, gMAlowLetterSprite, gMAcurrAth, MAathList, MAunusedAthList, gMAcurNameLength, gMAblanks, gMAcurrAthNum, MAuniqCharList, gMAspacelessName, MAflavor, MAmenuList, mouseUp, gMAnextLev, gMAathStr, mouseUp, gMALev
  503.   set gMALev to gMAnextLev
  504.   if MAnewGame = 1 then
  505.     set MAunusedAthList to value(string(MAathList))
  506.     set N to count(MAunusedAthList)
  507.     set vMArandomAthlete to random(N)
  508.     set gMAcurrAth to getPropAt(MAunusedAthList, vMArandomAthlete)
  509.     set gMAcurrAthNum to getAt(MAunusedAthList, vMArandomAthlete)
  510.     set MAflavor to getAt(MAmenuList, 1)
  511.   end if
  512.   set gMAspacelessName to gMAcurrAth
  513.   repeat with I = 1 to length(gMAspacelessName)
  514.     if char I of gMAspacelessName = " " then
  515.       delete char I of gMAspacelessName
  516.     end if
  517.   end repeat
  518.   if gMALev = 2 then
  519.     set vMAname to gMAspacelessName
  520.     set vMAnum to length(gMAspacelessName)
  521.     set X to EMPTY
  522.     repeat with I = 1 to length(gMAspacelessName)
  523.       set N to random(vMAnum)
  524.       set X to char N of vMAname
  525.       delete char N of vMAname
  526.       set vMAscrambledName to string(vMAscrambledName & X)
  527.       set vMAnum to vMAnum - 1
  528.     end repeat
  529.     set gMAspacelessName to vMAscrambledName
  530.   end if
  531.   set gMAathStr to string(gMAcurrAthNum)
  532.   if length(gMAathStr) < 3 then
  533.     set gMAathStr to string("0" & gMAcurrAthNum)
  534.   end if
  535.   if gMALev <> 2 then
  536.     set theChar to char 1 of gMAcurrAth
  537.     set N to 1
  538.     set vMAblankCount to 0
  539.     repeat while theChar <> EMPTY
  540.       puppetSprite(N + gMAlowLetterSprite - 1, 1)
  541.       if char N of gMAcurrAth = " " then
  542.         set the castNum of sprite (N + gMAlowLetterSprite - 1) to cast string("blank")
  543.         set vMAblankCount to vMAblankCount + 1
  544.       else
  545.         set the castNum of sprite (N + gMAlowLetterSprite - 1) to cast string("dash")
  546.       end if
  547.       if gMALev < 2 then
  548.         set the loc of sprite (N + gMAlowLetterSprite - 1) to point(5 + (N * 33), 459)
  549.       end if
  550.       if gMALev > 2 then
  551.         set the loc of sprite (N + gMAlowLetterSprite - 1) to point(5 + (N * 33), 1000)
  552.       end if
  553.       set N to N + 1
  554.       set theChar to char N of gMAcurrAth
  555.     end repeat
  556.   end if
  557.   if gMALev = 2 then
  558.     set theChar to char 1 of gMAspacelessName
  559.     set N to 1
  560.     set vMAblankCount to 0
  561.     repeat while theChar <> EMPTY
  562.       puppetSprite(N + gMAlowLetterSprite - 1, 1)
  563.       set the castNum of sprite (N + gMAlowLetterSprite - 1) to cast string("dash")
  564.       set the loc of sprite (N + gMAlowLetterSprite - 1) to point(5 + (N * 33), 459)
  565.       set N to N + 1
  566.       set theChar to char N of gMAspacelessName
  567.     end repeat
  568.   end if
  569.   set gMAcurNameLength to N - 1 - vMAblankCount
  570.   set gMAblanks to vMAblankCount
  571. end
  572.  
  573. on setUpCards MAnewGame
  574.   global uniquePairList, MAuniqueIconList, gMAcurNameLength, MArandomGridlist, MAanswergridList, MAclearedGrid, MAcharList, gMAcurrAth, gMAspacelessName, gMALev, MAuniqCharList
  575.   if MAnewGame = 1 then
  576.     set MAcharList to []
  577.     set vMAcharNums to length(gMAspacelessName)
  578.     repeat with vMAi = 1 to vMAcharNums
  579.       append(MAcharList, char vMAi of gMAspacelessName)
  580.     end repeat
  581.     set vMAnum to length(gMAspacelessName)
  582.     set MAuniqCharList to []
  583.     repeat with vMAi = 1 to vMAnum
  584.       set vChr to char vMAi of gMAspacelessName
  585.       set vFlag to 1
  586.       repeat with vMAn = vMAi - 1 down to 1
  587.         if vChr = char vMAn of gMAspacelessName then
  588.           set vFlag to 0
  589.           exit repeat
  590.         end if
  591.       end repeat
  592.       if vFlag then
  593.         add(MAuniqCharList, vChr)
  594.       end if
  595.     end repeat
  596.     MAdoUniqueIconList()
  597.     set MArandomGridlist to makeRandomGrid(count(MAuniqueIconList))
  598.     set MAanswergridList to makeAnswerGridList(MArandomGridlist)
  599.   end if
  600.   repeat with N = 1 to count(MAuniqueIconList)
  601.     set a to 0
  602.     set X to 0
  603.     repeat while a = 0
  604.       set X to X + 1
  605.       set a to getAt(MArandomGridlist, X)
  606.       if a = N then
  607.         set a to X
  608.         next repeat
  609.       end if
  610.       set a to 0
  611.     end repeat
  612.     set b to 0
  613.     repeat while b = 0
  614.       set X to X + 1
  615.       set b to getAt(MArandomGridlist, X)
  616.       if b = N then
  617.         set b to X
  618.         next repeat
  619.       end if
  620.       set b to 0
  621.     end repeat
  622.     if getAt(MAclearedGrid, a) = 1 then
  623.       set num to getAt(getAt(MAanimList, integer(char 8 of the name of cast getAt(MAuniqueIconList, N))), 1)
  624.       MAsetTile(a, num)
  625.       MAsetTile(b, num)
  626.     end if
  627.   end repeat
  628. end
  629.  
  630. on MAputStates
  631.   global MASavedList, gMAmenu, MAflavor, gMALev, gMAflip, gMAsound, gMAcurrAth, gMAcurrAthNum, MAunusedAthList, MAuniqueIconList, MArandomGridlist, MAanswergridList, gMAgameMarker, MAnewGame
  632.   set MASavedList to []
  633.   setAt(MASavedList, 1, gMAmenu)
  634.   setAt(MASavedList, 2, MAflavor)
  635.   setAt(MASavedList, 3, gMALev)
  636.   setAt(MASavedList, 4, gMAflip)
  637.   setAt(MASavedList, 5, gMAsound)
  638.   setAt(MASavedList, 6, gMAcurrAth)
  639.   setAt(MASavedList, 7, gMAcurrAthNum)
  640.   setAt(MASavedList, 8, MAunusedAthList)
  641.   setAt(MASavedList, 9, MAuniqueIconList)
  642.   setAt(MASavedList, 10, MArandomGridlist)
  643.   setAt(MASavedList, 11, MAanswergridList)
  644.   setAt(MASavedList, 12, gMAgameMarker)
  645.   setAt(MASavedList, 13, MAnewGame)
  646. end
  647.  
  648. on MAgetStates
  649.   global MASavedList, MAnewGame, gMAmenu, MAflavor, gMALev, gMAflip, gMAsound, gMAcurrAth, gMAcurrAthNum, MAunusedAthList, MAuniqueIconList, MArandomGridlist, MAanswergridList, gMAgameMarker
  650.   set gMAmenu to getAt(MASavedList, 1)
  651.   set MAflavor to getAt(MASavedList, 2)
  652.   set gMALev to getAt(MASavedList, 3)
  653.   set gMAflip to getAt(MASavedList, 4)
  654.   set gMAsound to getAt(MASavedList, 5)
  655.   set gMAcurrAth to getAt(MASavedList, 6)
  656.   set gMAcurrAthNum to getAt(MASavedList, 7)
  657.   set MAunusedAthList to getAt(MASavedList, 8)
  658.   set MAuniqueIconList to getAt(MASavedList, 9)
  659.   set MArandomGridlist to getAt(MASavedList, 10)
  660.   set MAanswergridList to getAt(MASavedList, 11)
  661.   set gMAgameMarker to getAt(MASavedList, 12)
  662.   set MAnewGame to getAt(MASavedList, 13)
  663.   if MAnewGame = 0 then
  664.     MAresumeGame()
  665.   else
  666.     MAinitGame()
  667.   end if
  668. end
  669.  
  670. on MAleaveGame
  671.   global gMAmatch
  672.   MAallOFF()
  673.   set gMAmatch to EMPTY
  674.   MAputStates()
  675.   cleanUp()
  676. end
  677.  
  678. on MAresumeGame
  679.   go("gameFrame")
  680.   goSetUp(0)
  681.   setUpCards(0)
  682.   MAshowLetters()
  683. end
  684.  
  685. on cleanUp
  686.   global MASavedList
  687.   DisableIdleAnim()
  688.   HSStatePut("MA", "savedList", string(MASavedList))
  689. end
  690.